<div class="style-list" id="editor-style-{{$item['id']}}"><!-- start style-list -->
	<?php $fraged = false;?>
		<div class="content" >
			{{if $item['brush_image']}}
				<img data-id="{{$item['id']}}" data-type="brushImage" src="/img/grey.gif" class="lazy hoverimg" data-src="{{$item['coverimg']}}" />
			{{elseif $item['cate_id']>=50}}
				<div class="text-center"><!-- image resource -->
				<?PHP 
				
				if($item['coverimg']){ //'data-src'=>$item['coverimg'],'class'=>'lazy',
					$appendStyle = 'max-width:100%;';
					if($item['cover_width']) { $appendStyle .= 'width:'.$item['cover_width'].'px !important;';}else{$item['cover_width']='auto';}
					if($item['cover_height']) { $appendStyle .= 'height:'.$item['cover_height'].'px !important;';}
					//$gif = is_wechat_gif($item['coverimg']);
					//if($gif){
					//	echo '<img src="/img/grey.gif" class="lazy" data-src="'.$item['coverimg'].'" title="'.$item['name'].'" style="'.$appendStyle.'">';
					//}
					//else{
						echo '<section style="display:inline-block;'.$appendStyle.'"><img src="/img/grey.gif" class="lazy" data-src="'.$item['coverimg'].'" title="'.$item['name'].'" style="'.$appendStyle.'"></section>';
					//}
				}
				?>
				</div>
			{{else}}
				{{if $item['cate_id']==3 }} <!-- template && $item['coverimg'] -->
						<div class="text-center">
							<img src="/img/grey.gif" class="lazy" data-src="{{$item['coverimg']}}" title="{{$item['name']}}" class="template-cover" data-id="{{$item['id']}}" >
						</div>
						<div class="editor-style-content hidden" {{if !$unuse_data_id}}data-id="{{$item['id']}}"{{/if}}  data-name="{{htmlspecialchars($item['name'])}}" id="template-{{$item['id']}}">
					<?php
						$content = preg_replace('/class="\w+"/is','',$item['content']);
						$content = str_replace('-webkit-border-image','border-image',$content);
						$content = preg_replace('/data-\w+="\w+"/is','',$content);
						echo $content;
					?>
						</div>
				{{else}}
					<div class="editor-style-content" {{if !$unuse_data_id}}data-id="{{$item['id']}}"{{/if}} data-name="{{htmlspecialchars($item['name'])}}" id="template-{{$item['id']}}">
					<?php
					if( !empty($frags)) {
						$content =  parseFragContent($item['content'],$frags[$frag_index],$frag_index);
						if( !empty($_SESSION['Auth']['Staff']) && $content != $item['content'] ) { $fraged = true;}
					}
					else{ 
						$content = $item['content']; 
					}
					$content = preg_replace('/data-\w+="\w+"/is','',$content);
					$content = preg_replace('/class="\w+"/is','',$content);
					//$content = lazyloadimg($content);
						
					echo $content;
					?>
					
				</div>
				{{/if}}
			{{/if}}
		</div><!-- end content -->
		<?php  
if($item['cate_id']>=50)
	$tooltip = __('EditorStyle Image Favorite Tips');
elseif($item['cate_id']==3)
	$tooltip = __('EditorStyle Template Favorite Tips');
else
	$tooltip = __('EditorStyle Style Favorite Tips');
 ?>
			<div class="tools clearfix">
				{{if $item['summary']}}
					<div style="border-bottom:1px solid #aaa;padding:15px;margin-bottom:10px;background:#eee;">
						<p style="white-space: pre-wrap;word-break: break-word;"><strong>使用说明：</strong><br>{{nl2br($item['summary'])}}</p>
					</div>
				{{/if}}
				<div class="title">
					<a href="{{$this->Html->url('/editor_styles/'.date('Ymd',strtotime($item['created'])).'/'.$item['id'].'.html')}}" target="_blank"><strong>ID:{{$item['id']}},{{$item['name']}}</strong></a>
					<!--<span><span class="ui-stats-num" id="Stats-EditorStyle-{{$item['id']}}-view_nums">{{$item['view_nums']}}</span></span>-->
					{{if $item['price'] <= 0.0 }}
						{{if $fovarited_list && $favor_id = array_search($item['id'],$fovarited_list)}}
								
								<a href="javascript:void(0)"  data-toggle="tooltip" data-container="body" data-placement="top"  class="btn-favorite btn-red pull-right" data-model="EditorStyle" data-id="{{$item['id']}}" title="{{__('Favorited Tips')}}" ><i class="fa fa-heart"></i> <span class="ui-stats-num" id="Stats-EditorStyle-{{$item['id']}}-favor_nums">{{$item['favor_nums']}}</span></a>
								<a class="btn-fav-refresh btn-red pull-right" style="margin:0 10px;" href="javascript:;"
	data-url="{{$this->Html->url('/favorites/refresh/'.$favor_id)}}" onclick="return refreshfavorite(this);"><i class="fa fa-arrow-up" data-toggle="tooltip" data-container="body" data-placement="top" title="收藏的找不到了？点击移到最前面"></i>
												</a>
												
						{{else}}

							{{if count($CurrentUser['role_id']) <2 && $item['only_paid']}}
								<a data-toggle="tooltip" data-container="body" data-placement="top" title="需要升级VIP会员，才能使用此样式" class="btn-default btn-sm btn  pull-right" href="http://www.135editor.com/tools/goplat?referer=http%3A%2F%2Fwww.135plat.com%2Fcharge-service" target="_blank">升级VIP会员使用</a>
							{{else}}
								<a href="javascript:void(0)"  data-toggle="tooltip" data-container="body" data-placement="top"  class="btn-favorite btn-red  pull-right" data-model="EditorStyle" data-id="{{$item['id']}}" title="{{$tooltip}}"><i class="fa fa-heart-o"></i> <span class="ui-stats-num" id="Stats-EditorStyle-{{$item['id']}}-favor_nums">{{$item['favor_nums']}}</span></a>
								{{if $item['score']}}
									<span class="pull-right"  data-toggle="tooltip" data-container="body" data-placement="top" style="color:#f5c510;margin:0 5px" title="收藏所需积分"><i class="fa fa-database"></i>{{$item['score']}}</span>
								{{/if}}	
							{{/if}}	
						{{/if}}	
					{{/if}}	
					
				</div>
				<!-- <p><small>添加时间：{{$item['created']}}</small></p> -->

				<div class="info">	
				
				<?php $created = strtotime($item['created']); $inteval = time() - $created;  ?>
				
				{{if $inteval < 432000}}					
					<p><a data-toggle="tooltip" data-container="body" data-placement="top" title="升级VIP会员，去除时间限制，快人一步" href="http://www.135editor.com/tools/goplat?referer=http%3A%2F%2Fwww.135plat.com%2Fcharge-service" target="_blank"><small>免费会员<strong><i>{{format_time_interval(432000-$inteval)}}</i></strong>后可收藏使用</small></a></p>
				{{/if}}
				</div>
				
				
				{{if $item['price'] > 0}}
					{{if $fovarited_list && $favor_id = array_search($item['id'],$fovarited_list)}}
						<p style="clear:both;line-height:42px;margin-top:10px">
							<a class="btn btn-default pull-right"
				 onclick="javascript:void(0)" disabled href="javascript:void(0)">已购买</a>
				 			<span class="product-price">{{format_price($item['price'])}}</span>
						</p>
					{{else}}
						<p style="clear:both;line-height:42px;margin-top:10px">
							<a aria-disabled="false" class="btn btn-warning btn-sm pull-right" style="color:#FFF;"
				 onclick="return directBuy({{$item['id']}},1,'EditorStyle');" href="javascript:void(0)">{{__('Buy Directly')}}</a>
				 			<span class="product-price">{{format_price($item['price'])}}</span>
						</p>
					{{/if}}
				{{/if}}
				
				{{if $data_tags[$item['id']]}}
					<p id="item-tags-{{$item['id']}}" style="margin: 5px 0 0;">
					{{loop $data_tags[$item['id']] $tid}}
						<a class="label label-info" rel="{{$tid}}" href="/style-center?tag_id={{$tid}}" target="_blank">{{$all_tags[$tid]}}</a> &nbsp;
					{{/loop}}
					</p>
					{{if !empty($_SESSION['Auth']['Staff']) }}
						<p><button title="更新后刷新查看" onclick="open_dialog({width:960},'{{Router::url('/admin/tags/list?type=select&operate=edit&targetid=item-tags-'.$item['id'].'&ids='.implode(',',$data_tags[$item['id']]).'&mid='.$item['id'].'&m=EditorStyle')}}')" class="btn btn-primary btn-sm" type="button"> +管理标签 </button></p>
					{{/if}}
				{{elseif $item_all['Tag']}}
					<p id="item-tags-{{$item['id']}}" style="margin: 5px 0 0;">
					<?php $tagids = array(); ?>
					{{loop $item_all['Tag'] $tag}}
						<?php $tagids[] = $tag['id']; ?>
						<a class="label label-info" rel="{{$tid}}" href="/style-center?tag_id={{$tag['id']}}" target="_blank">{{$tag['name']}}</a> &nbsp;
					{{/loop}}
					</p>
					{{if !empty($_SESSION['Auth']['Staff']) }}
						<p>	<button title="更新后刷新查看" onclick="open_dialog({width:960},'{{Router::url('/admin/tags/list?type=select&operate=edit&targetid=item-tags-'.$item['id'].'&ids='.implode(',',$tagids).'&mid='.$item['id'].'&m=EditorStyle')}}')" class="btn btn-primary btn-sm" type="button"> +管理标签 </button></p>
					{{/if}}
				{{else}}
					
					{{if !empty($_SESSION['Auth']['Staff']) }}
						<p id="item-tags-{{$item['id']}}" style="margin: 5px 0 0;"></p>
						<p>	<button title="更新后刷新查看" onclick="open_dialog({width:960},'{{Router::url('/admin/tags/list?type=select&operate=edit&targetid=item-tags-'.$item['id'].'&ids=&mid='.$item['id'].'&m=EditorStyle')}}')" class="btn btn-primary btn-sm" type="button"> +管理标签 </button></p>
					{{/if}}
				{{/if}}
				
				{{if !empty($_SESSION['Auth']['Staff']) }}
					<div style="margin-top:10px;">
						<p>
			    		<a class="btn btn-primary btn-sm" href="{{Router::url('/admin/'.$category_control_name.'/edit/'.$item['id'])}}" target="_blank"><i class="fa fa-edit"></i> {{__('Edit')}}</a>
			    		<a class="btn btn-primary btn-sm" href="{{Router::url('/admin/'.$category_control_name.'/edit/'.$item['id'])}}/copy" target="_blank"><i class="fa fa-copy"></i> {{__('Copy')}}</a>
						</p>
						<p>
			    		{{if $item['recommend']}}
			    			<label class="label label-default">已推荐</label>
							<input type="text" id="recommend-{{$item['id']}}" style="width:40px;height: 33px;font-size:12px;text-align:right;" value="{{$item['recommend']}}"><a class="btn btn-primary btn-sm showtooltip" title="推荐的将在未登录时显示。推荐值大的排前面" href="javascript:void(0)" onclick="ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/'+$('#recommend-{{$item['id']}}').val()+'/recommend');"> 修改推荐值</a>
							<a class="btn btn-primary btn-sm showtooltip" title="推荐的将在未登录时显示。" href="javascript:void(0)" onclick="if(confirm('是否确认取消推荐，取消后未登录用户不可见')){ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/0/recommend');}"> 取消推荐</a>
						{{else}}
			    			<label class="label label-default">未推荐</label><input type="text" id="recommend-{{$item['id']}}" style="width:40px;height: 33px;font-size:12px;text-align:right;" value="9"><a class="btn btn-primary btn-sm showtooltip" title="推荐的将在未登录时显示。推荐值大的排前面" href="javascript:void(0)" onclick="ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/'+$('#recommend-{{$item['id']}}').val()+'/recommend');"> 推荐</a>
			    		{{/if}}
						</p>

			    		{{if $_SESSION['Auth']['Staff']['id'] == 1 }}
						<p>
						{{if $item['only_paid']}}
						<a class="btn btn-primary btn-sm showtooltip" href="javascript:void(0)" onclick="ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/0/only_paid');"> VIP改免费</a>
						{{else}}
						<a class="btn btn-primary btn-sm showtooltip" href="javascript:void(0)" onclick="ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/1/only_paid');"> 设为VIP样式</a>
						{{/if}}

						{{if $item['wechat_auth']}}
						<a class="btn btn-primary btn-sm showtooltip" href="javascript:void(0)" onclick="ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/0/wechat_auth');"> 设为免授权使用</a>
						{{else}}
						<a class="btn btn-primary btn-sm showtooltip" href="javascript:void(0)" onclick="ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/1/wechat_auth');"> 设为需要授权使用</a>
						{{/if}}
						</p>
							{{if $item['status']}}
			    				<p><a class="btn btn-primary btn-sm showtooltip" href="javascript:void(0)" onclick="if(confirm('是否确认要下架样式，下架后在样式中心不可见，已收藏用户不可使用')){ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/0/status');}"> 下架</a>
			    				&nbsp;
			    				<a class="btn btn-primary btn-sm showtooltip" title="按当前时间将最近更新时间修改为7天前，是排前的样式稍微往后移。 很靠后的进行次操作的话，顺序将靠前至7天前的位置。" href="javascript:void(0)" onclick="return ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/{{date('Y-m-d',strtotime('-7 days'))}}/updated');"> 下沉一周</a>
			    					&nbsp;
			    				
			    				</p>
			    			{{else}}
			    				<p><a class="btn btn-primary btn-sm showtooltip" href="javascript:void(0)" onclick="if(confirm('是否确认要上架样式')){ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/1/status');}"> 上架</a>
			    				
			    				</p>
			    			{{/if}}
			    		{{/if}}
			    		<p>
			    		<input type="text" id="sort-up-{{$item['id']}}" style="width:40px;height: 33px;font-size:12px;text-align:right;" value="{{$item['sort']>0?$item['sort']:10000}}"><a class="btn btn-primary btn-sm showtooltip" title="提示：置顶操作时，置顶值大的排前面；相同置顶值时，ID大的排前面。" href="javascript:void(0)" onclick="ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/'+$('#sort-up-{{$item['id']}}').val()+'/sort');"><i class="fa fa-angle-double-up"></i> 置顶</a>
			    		{{if $item['sort']>0 }}
			    		<label class="label label-success">已置顶</label>&nbsp;<input type="text" id="sort-down-{{$item['id']}}" style="width:40px;height: 33px;font-size:12px;text-align:right;" value="0"><a class="btn btn-primary btn-sm" href="javascript:void(0)" onclick="ajaxAction('/admin/editor_styles/setfield/{{$item['id']}}/'+$('#sort-down-{{$item['id']}}').val()+'/sort');"><i class="fa fa-angle-double-down"></i> 取消置顶</a>
			    		{{else}}
			    		<label class="label label-default">未置顶</label>
			    		{{/if}}
			    		</p>
			    		<p>新增于：{{$item['created']}}. &nbsp; ID: {{$item['id']}}</p>
			    		<p>编辑于：{{$item['updated']}}</p>
			    	</div>
			    {{/if}}   
			</div><!-- end tools -->
			{{if !empty($_SESSION['Auth']['Staff']) && $fraged }}
			<div class="content" style="margin: 0px 5px 25px;padding:10px;" ><p style="color:#666;font-weight:bold;border-bottom:1px solid #ddd;">未替换原样式（请比对秒刷是否正确）</p><div class="editor-style-content">{{$item['content']}}</div></div>
			{{/if}}
</div><!-- end style-list -->
